package com.huawei.esdk.tp.northcommu.cxf.professional;

import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import com.huawei.esdk.platform.common.SDKErrorCode;
import com.huawei.esdk.platform.common.SDKResult;
import com.huawei.esdk.platform.common.exception.SDKException;
import com.huawei.esdk.platform.common.utils.StringUtils;
import com.huawei.esdk.tp.business.professional.sitemgr.SiteMgrService;
import com.huawei.esdk.tp.common.ErrInfo;
import com.huawei.esdk.tp.domain.model.Site;
import com.huawei.esdk.tp.domain.model.bean.CameraControl;
import com.huawei.esdk.tp.domain.model.bean.PagedList;
import com.huawei.esdk.tp.domain.model.bean.VideoSourcesInfo;
import com.huawei.esdk.tp.northcommu.cxf.professional.convert.TPProfessionalSiteMgrConvert;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.AddSiteInfoEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.AddSiteInfoExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.CtrlCameraEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.CtrlCameraExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.DeleteSiteInfoEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.DeleteSiteInfoExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.EditSiteInfoEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.EditSiteInfoExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.IsConnectAuxSourceEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.IsConnectAuxSourceExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.IsReceiveRemAuxStrmEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.IsReceiveRemAuxStrmExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.IsSendAuxStreamEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.IsSendAuxStreamExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QueryAuxStreamSourcesEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QueryAuxStreamSourcesExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QueryMainStreamSourcesEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QueryMainStreamSourcesExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QuerySiteVersionInfoEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QuerySiteVersionInfoExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QuerySitesInfoEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QuerySitesInfoExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QueryVideoOutSrcStateEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QueryVideoOutSrcStateExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.SetAuxStreamEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.SetAuxStreamExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.SetMainAuxStreamSourcesEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.SetMainAuxStreamSourcesExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.SetVideoOutSrcEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.SetVideoOutSrcExResponse;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.TPProfessionalSiteMgr;

/** * @author w00208247 * * */
public class TPProfessionalSiteMgrImpl implements TPProfessionalSiteMgr
{
    
    private static final Logger LOGGER = Logger.getLogger(TPProfessionalSiteMgrImpl.class);
    
    TPProfessionalSiteMgrConvert tpProfessionalSiteMgrConvert = null;
    
    SiteMgrService siteMgrService = null;
    
    public TPProfessionalSiteMgrConvert getTpProfessionalSiteMgrConvert()
    {
        return tpProfessionalSiteMgrConvert;
    }
    
    public void setTpProfessionalSiteMgrConvert(TPProfessionalSiteMgrConvert tpProfessionalSiteMgrConvert)
    {
        this.tpProfessionalSiteMgrConvert = tpProfessionalSiteMgrConvert;
    }
    
    public SiteMgrService getSiteMgrService()
    {
        return siteMgrService;
    }
    
    public void setSiteMgrService(SiteMgrService siteMgrService)
    {
        this.siteMgrService = siteMgrService;
    }
    
    /**
     * * @see com.huawei.esdk.tp.northcommu.cxf.professional.gen.
     * TPProfessionalSiteMgr
     * #setMainAuxStreamSourcesEx(com.huawei.esdk.tp.northcommu
     * .cxf.professional.gen.SetMainAuxStreamSourcesEx)
     */
    @Override
    public SetMainAuxStreamSourcesExResponse setMainAuxStreamSourcesEx(SetMainAuxStreamSourcesEx parameters)
    {
        SetMainAuxStreamSourcesExResponse response = new SetMainAuxStreamSourcesExResponse();
        try
        {
            if (null == parameters || null == parameters.getLocalMainSrcs())
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            int retCode =
                siteMgrService.setMainAuxStreamSourcesEx(parameters.getSiteUri(),
                    parameters.getLocalMainSrcs(),
                    parameters.getLocalAuxSrc());
            response.setResultCode(retCode);
        }
        catch (SDKException ex)
        {
            LOGGER.error("setMainAuxStreamSourcesEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("setMainAuxStreamSourcesEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    /**
     * * @see com.huawei.esdk.tp.northcommu.cxf.professional.gen.
     * TPProfessionalSiteMgr
     * #queryMainStreamSourcesEx(com.huawei.esdk.tp.northcommu
     * .cxf.professional.gen.QueryMainStreamSourcesEx)
     */
    @Override
    public QueryMainStreamSourcesExResponse queryMainStreamSourcesEx(QueryMainStreamSourcesEx parameters)
    {
        QueryMainStreamSourcesExResponse response = new QueryMainStreamSourcesExResponse();
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            SDKResult<Map<Integer, String>> result = siteMgrService.queryMainStreamSourcesEx(parameters.getSiteUri());
            // 转换:将Domain Bean转换为协议相关的Bean
            if (0 == result.getErrCode())
            {
                response = tpProfessionalSiteMgrConvert.queryMainStreamSourcesExConvert(result.getResult());
            }
            else
            {
                response.setResultCode((int)result.getErrCode());
            }
        }
        catch (SDKException ex)
        {
            LOGGER.error("queryMainStreamSourcesEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("queryMainStreamSourcesEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    /**
     * * @see com.huawei.esdk.tp.northcommu.cxf.professional.gen.
     * TPProfessionalSiteMgr
     * #isReceiveRemAuxStrmEx(com.huawei.esdk.tp.northcommu.
     * cxf.professional.gen.IsReceiveRemAuxStrmEx)
     */
    @Override
    public IsReceiveRemAuxStrmExResponse isReceiveRemAuxStrmEx(IsReceiveRemAuxStrmEx parameters)
    {
        IsReceiveRemAuxStrmExResponse response = new IsReceiveRemAuxStrmExResponse();
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            SDKResult<Integer> result = siteMgrService.isReceiveRemAuxStrmEx(parameters.getSiteUri());
            response.setResultCode((int)result.getErrCode());
            if (null != result.getResult())
            {
                response.setResult(result.getResult());
            }
        }
        catch (SDKException ex)
        {
            LOGGER.error("isReceiveRemAuxStrmEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("isReceiveRemAuxStrmEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    /**
     * 设置开始或停止发送辅流 * @see com.huawei.esdk.tp.northcommu.cxf.professional.gen.
     * TPProfessionalSiteMgr
     * #setAuxStreamEx(com.huawei.esdk.tp.northcommu.cxf.professional
     * .gen.SetAuxStreamEx)
     */
    @Override
    public SetAuxStreamExResponse setAuxStreamEx(SetAuxStreamEx parameters)
    {
        SetAuxStreamExResponse response = new SetAuxStreamExResponse();
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            SDKErrorCode errorCode =
                siteMgrService.setAuxStreamEx(parameters.getSiteUri(), parameters.getControlCode());
            response.setResultCode((int)errorCode.getErrCode());
        }
        catch (SDKException ex)
        {
            LOGGER.error("setAuxStreamEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("setAuxStreamEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    /**
     * * @see com.huawei.esdk.tp.northcommu.cxf.professional.gen.
     * TPProfessionalSiteMgr
     * #ctrlCameraEx(com.huawei.esdk.tp.northcommu.cxf.professional
     * .gen.CtrlCameraEx)
     */
    @Override
    public CtrlCameraExResponse ctrlCameraEx(CtrlCameraEx parameters)
    {
        CtrlCameraExResponse response = new CtrlCameraExResponse();
        CameraControl control = new CameraControl();
        SDKErrorCode result = null;
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            // A: 转换:将协议相关的Bean转换为Domain Bean
            if (null == parameters.getCameraControl() || null == parameters.getCameraControl().getCamAction()
                || null == parameters.getCameraControl().getCamPos()
                || null == parameters.getCameraControl().getCamSrc()
                || null == parameters.getCameraControl().getCamState())
            {
                result = new SDKErrorCode();
                result.setErrCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
            }
            else
            {
                control.setCamAction(parameters.getCameraControl().getCamAction());
                control.setCamPos(parameters.getCameraControl().getCamPos());
                control.setCamSrc(parameters.getCameraControl().getCamSrc());
                if (0 == parameters.getCameraControl().getCamState())
                {
                    control.setCamState("localCam");
                }
                else
                {
                    control.setCamState("remoteCam");
                }
                result = siteMgrService.ctrlCameraEx(parameters.getSiteUri(), control);
            }
        }
        catch (SDKException ex)
        {
            result = new SDKErrorCode();
            LOGGER.error("ctrlCamera method error", ex);
            result.setErrCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            result = new SDKErrorCode();
            LOGGER.error("ctrlCamera method error", e);
            result.setErrCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        
        response.setResultCode((int)result.getErrCode());
        
        return response;
    }
    
    /**
     * * @see com.huawei.esdk.tp.northcommu.cxf.professional.gen.
     * TPProfessionalSiteMgr
     * #queryVideoOutSrcStateEx(com.huawei.esdk.tp.northcommu
     * .cxf.professional.gen.QueryVideoOutSrcStateEx)
     */
    @Override
    public QueryVideoOutSrcStateExResponse queryVideoOutSrcStateEx(QueryVideoOutSrcStateEx parameters)
    {
        QueryVideoOutSrcStateExResponse response = new QueryVideoOutSrcStateExResponse();
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            SDKResult<List<VideoSourcesInfo>> result = siteMgrService.queryVideoOutSrcStateEx(parameters.getSiteUri());
            // 转换:将Domain Bean转换为协议相关的Bean
            if (result.getErrCode() == 0)
            {
                response = tpProfessionalSiteMgrConvert.queryVideoOutSrcStateExConvert(result.getResult());
            }
            else
            {
                response.setResultCode((int)result.getErrCode());
            }
        }
        catch (SDKException ex)
        {
            LOGGER.error("queryVideoOutSrcStateEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("queryVideoOutSrcStateEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    /**
     * * @see com.huawei.esdk.tp.northcommu.cxf.professional.gen.
     * TPProfessionalSiteMgr
     * #setVideoOutSrcEx(com.huawei.esdk.tp.northcommu.cxf.professional
     * .gen.SetVideoOutSrcEx)
     */
    @Override
    public SetVideoOutSrcExResponse setVideoOutSrcEx(SetVideoOutSrcEx parameters)
    {
        SetVideoOutSrcExResponse response = new SetVideoOutSrcExResponse();
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            int retCode =
                siteMgrService.setVideoOutSrcEx(parameters.getSiteUri(),
                    parameters.getHdOut(),
                    parameters.getVideoSrc());
            response.setResultCode(retCode);
        }
        catch (SDKException ex)
        {
            LOGGER.error("setVideoOutSrcEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("setVideoOutSrcEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    /**
     * * @see com.huawei.esdk.tp.northcommu.cxf.professional.gen.
     * TPProfessionalSiteMgr
     * #queryAuxStreamSourcesEx(com.huawei.esdk.tp.northcommu
     * .cxf.professional.gen.QueryAuxStreamSourcesEx)
     */
    @Override
    public QueryAuxStreamSourcesExResponse queryAuxStreamSourcesEx(QueryAuxStreamSourcesEx parameters)
    {
        QueryAuxStreamSourcesExResponse response = new QueryAuxStreamSourcesExResponse();
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            SDKResult<Map<Integer, String>> result = siteMgrService.queryAuxStreamSources(parameters.getSiteUri());
            response = tpProfessionalSiteMgrConvert.sdkResult2QueryAuxStreamSourcesExResponse(result);
        }
        catch (SDKException ex)
        {
            LOGGER.error("queryAuxStreamSourcesEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("queryAuxStreamSourcesEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    /**
     * * @see com.huawei.esdk.tp.northcommu.cxf.professional.gen.
     * TPProfessionalSiteMgr
     * #isConnectAuxSourceEx(com.huawei.esdk.tp.northcommu.cxf
     * .professional.gen.IsConnectAuxSourceEx)
     */
    @Override
    public IsConnectAuxSourceExResponse isConnectAuxSourceEx(IsConnectAuxSourceEx parameters)
    {
        IsConnectAuxSourceExResponse response = new IsConnectAuxSourceExResponse();
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            SDKResult<Integer> result = siteMgrService.isConnectAuxStreamEx(parameters.getSiteUri());
            response.setResultCode((int)result.getErrCode());
            if (null != result.getResult())
            {
                response.setResult(result.getResult());
            }
        }
        catch (SDKException ex)
        {
            LOGGER.error("isConnectAuxSourceEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("isConnectAuxSourceEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    /**
     * * @see com.huawei.esdk.tp.northcommu.cxf.professional.gen.
     * TPProfessionalSiteMgr
     * #isSendAuxStreamEx(com.huawei.esdk.tp.northcommu.cxf.
     * professional.gen.IsSendAuxStreamEx)
     */
    @Override
    public IsSendAuxStreamExResponse isSendAuxStreamEx(IsSendAuxStreamEx parameters)
    {
        IsSendAuxStreamExResponse response = new IsSendAuxStreamExResponse();
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            SDKResult<Integer> result = siteMgrService.isSendAuxStreamEx(parameters.getSiteUri());
            response.setResultCode((int)result.getErrCode());
            if (null != result.getResult())
            {
                response.setResult(result.getResult());
            }
        }
        catch (SDKException ex)
        {
            LOGGER.error("isSendAuxStreamEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("isSendAuxStreamEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    @Override
    public QuerySiteVersionInfoExResponse querySiteVersionInfoEx(QuerySiteVersionInfoEx parameters)
    {
        QuerySiteVersionInfoExResponse response = new QuerySiteVersionInfoExResponse();
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            SDKResult<Site> result = siteMgrService.querySiteVersionInfoEx(parameters.getSiteUri());
            response = tpProfessionalSiteMgrConvert.sdkResult2QuerySiteVersionInfoExResponse(result);
        }
        catch (SDKException ex)
        {
            LOGGER.error("querySiteVersionInfoEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("querySiteVersionInfoEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    @Override
    public QuerySitesInfoExResponse querySitesInfoEx(QuerySitesInfoEx parameters)
    {
        QuerySitesInfoExResponse response = new QuerySitesInfoExResponse();
        
        // modify by c00316442 2015.02.03，修改CodeCC问题，查询条件需要放在这边判断，在转换类中判断后直接return null，方法会走到南向，有空指针
        if (null == parameters || null == parameters.getQueryConfig())
        {
            response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
            return response;
        }
        
        try
        {
            SDKResult<PagedList<Site>> sites =
                siteMgrService.querySitesByCondition(tpProfessionalSiteMgrConvert.queryAllSitesExSoap2Modal(parameters));
            
            response = tpProfessionalSiteMgrConvert.queryAllSitesExModal2Soap(sites);
        }
        catch (SDKException ex)
        {
            LOGGER.error("querySitesInfoEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("querySitesInfoEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    @Override
    public DeleteSiteInfoExResponse deleteSiteInfoEx(DeleteSiteInfoEx parameters)
    {
        DeleteSiteInfoExResponse response = new DeleteSiteInfoExResponse();
        try
        {
            if (null == parameters)
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            SDKErrorCode errorCode = siteMgrService.deleteSiteInfoEx(parameters.getSiteUris());
            
            response.setResultCode((int)errorCode.getErrCode());
        }
        catch (SDKException ex)
        {
            LOGGER.error("deleteSiteInfoEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("deleteSiteInfoEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        return response;
    }
    
    @Override
    public EditSiteInfoExResponse editSiteInfoEx(EditSiteInfoEx parameters)
    {
        EditSiteInfoExResponse response = new EditSiteInfoExResponse();
        
        try
        {
            // DTS2015012704575 会场类型type内容为空，编辑会场信息，返回2130000010错误
            // 在北向加上判断，如果必填参数为空，则返回错误码
            if (null == parameters || null == parameters.getSiteInfo()
                || StringUtils.isEmpty(parameters.getSiteInfo().getName())
                || StringUtils.isEmpty(parameters.getSiteInfo().getUri()) || null == parameters.getSiteInfo().getType())
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            
            SDKErrorCode result =
                siteMgrService.editSiteInfoEx(tpProfessionalSiteMgrConvert.editSiteInfoExSoap2Modal(parameters));
            response.setResultCode((int)result.getErrCode());
        }
        catch (SDKException ex)
        {
            LOGGER.error("editSiteInfoEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("editSiteInfoEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        
        return response;
    }
    
    @Override
    public AddSiteInfoExResponse addSiteInfoEx(AddSiteInfoEx parameters)
    {
        AddSiteInfoExResponse response = new AddSiteInfoExResponse();
        
        try
        {
            // DTS2015012607447 siteInfo内容为空，添加会场信息，返回2130000010错误
            // 在北向加上参数判断，如果必填参数为空，则返回错误码
            if (null == parameters || null == parameters.getOrgId() || null == parameters.getSiteInfo()
                || null == parameters.getSiteInfo().getName() || null == parameters.getSiteInfo().getUri()
                || null == parameters.getSiteInfo().getType())
            {
                response.setResultCode(ErrInfo.SDK_PARAM_NOT_COMPLETE_ERRORCODE);
                return response;
            }
            
            SDKErrorCode result =
                siteMgrService.addSiteInfoEx(tpProfessionalSiteMgrConvert.addSiteInfoExSoap2Modal(parameters));
            response.setResultCode((int)result.getErrCode());
        }
        catch (SDKException ex)
        {
            LOGGER.error("addSiteInfoEx method error", ex);
            response.setResultCode((int)ex.getSdkErrCode());
        }
        catch (Exception e)
        {
            LOGGER.error("addSiteInfoEx method error", e);
            response.setResultCode(ErrInfo.SDK_SYSTEM_ERRORCODE);
        }
        
        return response;
    }
}
